package two.chapter_4.c4_2;

public class TransitiveClosure {
    private DirectedDFS[]all;
    public TransitiveClosure(Digragh g){
        all=new DirectedDFS[g.v()];
        for (int v=0;v<g.v();v++){
            all[v]=new DirectedDFS(g,v);
        }
    }

    /**
     * w是从v可达的吗
     * @param v
     * @param w
     * @return
     */
    public boolean reachable(int v,int w){
        return all[v].marked(w);
    }
}
